﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DataTool;

namespace workflowMVC.Controllers
{
    public class TaskFormController : Controller
    {
        //
        // GET: /TaskForm/

        public ActionResult Index()
        {
            return View();
        }

        public string getConfirmStuForm(Guid Id)
        {
            Util.getConfirmStuForm(this.HttpContext, Id);
            return Util.getFormHtmlCode(Url.Action("DocForm.aspx", "AspNetForms"));
        }

        public string getExcemptTuitionForm(Guid Id)
        {
            Util.getExcemptStudentForm(this.HttpContext, Id);
            return Util.getFormHtmlCode(Url.Action("DocForm.aspx", "AspNetForms"));
        }

        public string getStudentCardForm(Guid Id)
        {
            Util.getConfirmStuForm(this.HttpContext, Id);
            return Util.getFormHtmlCode(Url.Action("DocForm.aspx", "AspNetForms"));
        }

        public ActionResult getForm(Guid Id)
        {
            wfdbEntities db = new wfdbEntities();
            switch (db.TASKs.SingleOrDefault(x => x.Id == Id).Kind)
            {
                case 1: return RedirectToAction("getConfirmStuForm", new { id = Id });
                case 2: return RedirectToAction("getExcemptTuitionForm", new { id = Id });
                case 3: return RedirectToAction("getStudentCardForm", new { id = Id });
            }
            return null;
        }

    }
}
